package com.hqq.dao;

import com.hqq.domain.WoocType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * WoocTypeDao
 * Created by heqianqian on 2018/3/25.
 */
@Repository
public interface WoocTypeDao {

    String TABLE_NAME = "wooc_type";
    String SELECT_FIELD = "type_id as typeId,type_name as typeName,type_parent_id as typeParentId";

    /**
     * 根据id查询
     *
     * @param cardTypeId
     * @return
     */
    @Select("SELECT " + SELECT_FIELD + " FROM " + TABLE_NAME + " WHERE type_id = #{typeId}")
    WoocType findWoocTypeById(@Param("typeId") Long cardTypeId);

    /**
     * 查找类型
     *
     * @param parentId
     * @return
     */
    List<WoocType> listByParentId(@Param("parentId") Long parentId);
}
